#coding=utf-8
__author__ = 'czq'
def isExits():
    from django.db import connection, transaction
    cursor = connection.cursor()

    # Data modifying operation - commit required
    #cursor.execute("UPDATE bar SET foo = 1 WHERE baz = %s", [''])
    #transaction.commit_unless_managed()

    # Data retrieval operation - no commit required
    cursor.execute("SELECT foo FROM bar WHERE baz = %s", [''])
    row = cursor.fetchone()

    return row
    #return False

def ExecuteSql(sqlStr):
    from django.db import connection,transaction
    cursor = connection.cursor()            #获得一个游标(cursor)对象
    #更新操作
    cursor.execute(sqlStr)    #执行sql语句
    transaction.commit_unless_managed()     #提交到数据库

